package com.fhz.a2102shopjava;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;

import com.fhz.a2102shopjava.databinding.ActivitySplashBinding;
import com.fhz.a2102shopjava.util.AdvertisingUtil;

/**
 * 欢迎
 */
public class SplashActivity extends AppCompatActivity {

    private static final String TAG = "SplashActivity";
    private ActivitySplashBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivitySplashBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        getLifecycle().addObserver(AdvertisingUtil.getInstance());
        new CountDownTimer(1000,1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                Log.i(TAG, "onTick: ");
                binding.splashTime.setText(String.valueOf((int) millisUntilFinished / 1000).concat("秒"));
            }

            @Override
            public void onFinish() {
                Log.i(TAG, "onFinish: ");
                MainActivity.launch(SplashActivity.this);
                finish();
            }
        }.start();



    }
}